<template>
	<view class="p20">
		<view class="mb20 radius20 bg-fff pt20">
			<view class="flex pr20">
				<view class="w6 h20 bg-zs radius4 "></view>
				<view class="fs30 color-232323 ml20 flex1">陪诊师</view>
			</view>
			<view class="p26 flex"
				@click="$u.route('/pages/index/attendantDeatils/attendantDeatils',{master_id:data.master_id})">
				<image :src="data.avatar" class="h92 w92 radius" mode="aspectFill"></image>
				<view class="pl24 flex flex1 color-999">
					<view class="fs28 color-333 fw-700 flex1">{{data.name}}</view>
					<view class="">陪诊师详情</view>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
		</view>

		<view class="pl20 pr20 bg-fff radius20 ">
			<u-form labelWidth="auto">
				<u-form-item label="服务类型">
					<view class="text-right w-max">{{data.service_name}}</view>
				</u-form-item>
				<u-form-item label="服务类型">
					<u-input :value="form.type" @click="typeShow=!typeShow" inputAlign="right" placeholder="请选择投诉类型" type="select" :selectOpen="typeShow" />
				</u-form-item>
				<u-form-item label="描述内容" labelPosition="top">
					<view class="p20 bg-f5f radius20 w-max">
						<u-input type="textarea" v-model="form.content" placeholder="请填写投诉内容" :clearable="false" />
					</view>
				</u-form-item>
				<view class="h50"></view>
				<u-button type="warning" ripple @click="submit">确定</u-button>
			</u-form>
		</view>

		<u-select v-model="typeShow" :list="complaint_type" @confirm="setType"></u-select>
	</view>
</template>

<script>
	export default {
		computed: {
			complaint_type() {
				let arr = this.$config.complaint_type
				return arr.map(e => {
					return {
						label: e,
						value: e,
					}
				})
			}
		},
		data() {
			return {
				typeShow: false,
				data: '',
				form: {
					// order_id: '',
					type: '',
					content: '' // 投诉内容
				}
			};
		},
		onShow() {
			this.getData()
		},
		methods: {
			getData() {
				this.$request('/member/order/orderInfo', this.$params).then(res => {
					this.data = res.data
				})
			},
			setType(e) {
				this.form.type = e[0].value
			},
			submit(){
				let form={
					...this.$params,
					...this.form
				}
				if(!form.type)return this.$msg('请选择投诉类型')
				if(!form.content)return this.$msg('请填写投诉内容')
				this.$request('/member/order/complaint',form).then(res => {
					this.$msg(res.msg)
					this.$navBack(1,1000)
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
